package lzzy9;

public class GenericMethodDemo {
  public static void main(String[] args ) {
    Integer[] integers = {1, 2, 3, 4, 5};
    String[] strings = {"London", "Paris", "New York", "Austin"};
    GenericMethodDemo.print(integers);
    GenericMethodDemo.print(strings);

    // 新增一个double数组调用
    Double[] doubles = {2.3,4.3,5.3};
    GenericMethodDemo.print(doubles);

    //新增一个学生类数组调用
    Student stu_1 = new Student("1","韦国荣","20200317029");
    Student stu_2 = new Student("2","www","26580");
    Student stu_3 = new Student("3","rrr","81913043");
    Student[] student = {stu_1,stu_2,stu_3};
    lzzy9.GenericMethodDemo.println(student);
  }

  public static <E> void print(E[] list) {
    for (int i = 0; i < list.length; i++)
      System.out.print(list[i] + " ");
    System.out.println();
  }
  public static <E> void println(E[] list) {
    for (int i = 0; i< list.length; i++)
      System.out.println(list[i] + " ");
    System.out.println();
  }
}
